package com.jp.knowledge.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;
import android.view.WindowManager;

import com.jp.knowledge.R;
import com.jp.knowledge.logic.PersonLogic;
import com.jp.knowledge.service.CheckVersionService;

/**
 * 欢迎页面
 */
public class WelcomActivity extends AppCompatActivity {

    private PersonLogic personLogic;

    private Handler handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            startActivity(new Intent(WelcomActivity.this,JpMainActivity.class));
            WelcomActivity.this.finish();
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_welcom);

        personLogic = new PersonLogic(this);
        personLogic.getUserData();//获取用户信息
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                handler.sendEmptyMessage(0);
            }
        },2000);

        startService(new Intent(this, CheckVersionService.class));
    }
}
